﻿using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
namespace INTEX.DataBase.Tools
{
    public partial class INTEXDBC
    {
        public DataRow Convert2ICC_ABAX(DataRow dwInput, string ITXDBVERSION, bool IsConvert = false)
        {
            DataSet SResult = new DataSet();
            SResult = QueryICC_ABAX(dwInput, 0);
            DataRow dwReturn = null;
            if (SResult.Tables[0].Rows.Count > 0)
            {
                dwReturn = SResult.Tables[0].Rows[0];
            }
            else
            {
                dwReturn = SResult.Tables[0].NewRow();
            }
            switch (ITXDBVERSION)
            {
                case "YGR":
                case "JLT":
                default:
                    #region====JLT======
                    dwReturn["ABAID"] = "0";
                    dwReturn["ABAMANDANT"] = "00";
                    dwReturn["ABAAUFTYP"] = " ";
                    dwReturn["ABAAUFKRS"] = "  ";
                    dwReturn["ABAAUFLFD"] = "000000";
                    dwReturn["ABAAUFPOS"] = "   ";
                    dwReturn["ABAAPOS"] = "    ";
                    dwReturn["ABAWAKZ"] = " ";
                    dwReturn["ABAART"] = "                    ";
                    dwReturn["ABAVAR"] = "   ";
                    dwReturn["ABAFARBE"] = "          ";
                    dwReturn["ABAVKART"] = "                    ";
                    dwReturn["ABAVKFARBE"] = "          ";
                    dwReturn["ABABESCHICH"] = "          ";
                    dwReturn["ABAGROE"] = "       ";
                    dwReturn["ABACOLORREF"] = "                    ";
                    dwReturn["ABAERLKZ"] = " ";
                    dwReturn["ABARESMG"] = "0";
                    dwReturn["ABASSTKWG"] = "0";
                    dwReturn["ABARESKG"] = "0";
                    dwReturn["ABABASMG"] = "0";
                    dwReturn["ABAABF"] = "0";
                    dwReturn["ABAREUNIT"] = "0";
                    dwReturn["ABABSFDZ"] = "0";
                    dwReturn["BMBAUMKRS"] = "  ";
                    dwReturn["BMBAUMLFD"] = "      ";
                    dwReturn["ABAUMART"] = "      ";
                    dwReturn["ABALLEIST"] = "    ";
                    dwReturn["ABARLEIST"] = "    ";
                    dwReturn["ABADOMKZ"] = " ";
                    dwReturn["ABAQTYRESERVE"] = "0";
                    dwReturn["ABAQTYALLOCATE"] = "0";
                    dwReturn["ABAQTYRECEIVED"] = "0";
                    dwReturn["ABAVKAUFTYP"] = " ";
                    dwReturn["ABAVKAUFKRS"] = "  ";
                    dwReturn["ABAVKAUFLFD"] = "      ";
                    dwReturn["ABAVKAUFPOS"] = "   ";
                    dwReturn["ABAVKUPOS"] = "    ";
                    dwReturn["ABASANZSTK"] = "0";
                    dwReturn["ABASSTKLG"] = "0";
                    dwReturn["ABAVB"] = "   ";
                    dwReturn["ABAVG"] = "   ";
                    dwReturn["ABARVSACHB"] = "        ";
                    dwReturn["ABARKUNDNR"] = "        ";
                    dwReturn["ABAVLSACHB"] = "        ";
                    dwReturn["ABAVLVB"] = "   ";
                    dwReturn["ABAAUFMSL"] = "  ";
                    dwReturn["ABAVLVG"] = "   ";
                    dwReturn["PREALLOCATED"] = "0";
                    dwReturn["REPEATORDER"] = "   ";
                    dwReturn["FSARTPRGR"] = "   ";
                    dwReturn["ABPWAKZ"] = " ";
                    dwReturn["ABPART"] = "                    ";
                    dwReturn["ABPVAR"] = "   ";
                    dwReturn["ABPFARBE"] = "          ";
                    dwReturn["ABPBESCHICH"] = "          ";
                    dwReturn["ABPGROE"] = "       ";
                    dwReturn["FSABEZ"] = "                ";
                    dwReturn["FSFFBEZ"] = "                    ";
                    dwReturn["LSLIEFNR"] = "        ";
                    dwReturn["LSLIEFNA"] = "          ";
                    dwReturn["ABANEUDAT"] = "0";
                    dwReturn["SELLER"] = "          ";
                    dwReturn["SELLERNAME"] = "                ";
                    dwReturn["FSSZUSCHN"] = " ";
                    dwReturn["MTYPE"] = " ";
                    dwReturn["CDES"] = "            ";
                    dwReturn["ARTDES"] = "            ";
                    dwReturn["QTYSTD"] = "0";
                    dwReturn["QTYPLAN"] = "0";
                    dwReturn["QTYACT"] = "0";
                    dwReturn["PRSTD"] = "0";
                    dwReturn["PREK"] = "0";
                    dwReturn["PRPLAN"] = "0";
                    dwReturn["VQTYSTDPRSTD"] = "0";
                    dwReturn["VQTYSTDPREK"] = "0";
                    dwReturn["VQTYSTDPRPLAN"] = "0";
                    dwReturn["VQTYPLANPRSTD"] = "0";
                    dwReturn["VQTYPLANPREK"] = "0";
                    dwReturn["VQTYPLANPRPLAN"] = "0";
                    dwReturn["VQTYACTPRSTD"] = "0";
                    dwReturn["VQTYACTPREK"] = "0";
                    dwReturn["VQTYACTPRPLAN"] = "0";
                    dwReturn["MTRREQ"] = "0";
                    dwReturn["REQ"] = "0";
                    dwReturn["REMARK"] = "                ";
                    dwReturn["RATIO"] = "0";
                    dwReturn["UM"] = "   ";
                    dwReturn["CONTROL"] = "   ";
                    dwReturn["EXART"] = "                    ";
                    dwReturn["EXCOLOR"] = "          ";

                    dwReturn["FBRTU"] = "0";
                    dwReturn["FBRTL"] = "0";
                    dwReturn["ABAVKENDD"] = "0       ";
                    dwReturn["ABAVKSTARTD"] = "0";
                    dwReturn["ABASA"] = "0";
                    dwReturn["ABALO"] = "  ";
                    dwReturn["ABALB"] = "  ";
                    dwReturn["ABALP"] = "        ";
                    dwReturn["ABADISPOKZ"] = "B";
                    dwReturn["ABAUSER"] = "        ";
                    dwReturn["ABADATE"] = "0";
                    #endregion
                    break;
            }
            if (IsConvert)
            {
                foreach (DataColumn cm in dwInput.Table.Columns)
                {
                    if (dwInput[cm.ColumnName].ToString() == "")
                        continue;
                    if (dwReturn.Table.Columns.Contains(cm.ColumnName))
                    {
                        dwReturn[cm.ColumnName] = dwInput[cm.ColumnName];
                    }
                }
            }
            return dwReturn;
        }
        public void MapICC_ABAX(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }
        public void SaveICC_ABAX(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            DataSet Result = new DataSet();
            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;
            switch (ITXDBVERSION)
            {
                case "JLT":
                    Result = QueryICC_ABAX(dwData);
                    if (Result.Tables.Count > 0)
                    {
                        tbLocal = Result.Tables[0];
                        if (tbLocal.Rows.Count > 0)
                        {
                            flgExist = true;
                            dwLocal = tbLocal.Rows[0];
                        }
                        else
                        {
                            dwLocal = tbLocal.NewRow();
                        }
                    }

                    MapICC_ABAX(ref dwLocal, dwData);

                    if (!flgExist)
                    {
                        dwLocal["ABAID"] = GetSeq();
                        InsertICC_ABAX(dwLocal, 1);
                    }
                    UpdateICC_ABAX(dwLocal, 1);
                    break;
                case "YCA":
                default:
                    Result = QueryICC_ABAX(dwData);
                    if (Result.Tables.Count > 0)
                    {
                        tbLocal = Result.Tables[0];
                        if (tbLocal.Rows.Count > 0)
                        {
                            flgExist = true;
                            dwLocal = tbLocal.Rows[0];
                        }
                        else
                        {
                            dwLocal = tbLocal.NewRow();
                        }
                    }

                    MapICC_ABAX(ref dwLocal, dwData);

                    if (!flgExist)
                    {
                        dwLocal["ABAID"] = GetSeq();
                        InsertICC_ABAX(dwLocal, 1);
                    }
                    UpdateICC_ABAX(dwLocal, 1);
                    break;
            }
        }
        public void DeleteICC_ABAX(DataRow dwData, int option = 1)
        {

            OracleCommand or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "DELETE FROM ICC_ABAX WHERE ABAID=:ABAID";
                    or1.Parameters.Add("ABAID", OracleType.NVarChar).Value = dwData["ABAID"].ToString();
                    break;
                case 2:
                    or1.CommandText = "DELETE FROM ICC_ABAX WHERE ABAMANDANT=:ABAMANDANT AND ABAAUFTYP=:ABAAUFTYP AND ABAAUFKRS=:ABAAUFKRS AND ABAAUFLFD=:ABAAUFLFD";
                    or1.Parameters.Add("ABAMANDANT", OracleType.NVarChar).Value = dwData["ABAMANDANT"].ToString();
                    or1.Parameters.Add("ABAAUFTYP", OracleType.NVarChar).Value = dwData["ABAAUFTYP"].ToString();
                    or1.Parameters.Add("ABAAUFKRS", OracleType.NVarChar).Value = dwData["ABAAUFKRS"].ToString();
                    or1.Parameters.Add("ABAAUFLFD", OracleType.NVarChar).Value = dwData["ABAAUFLFD"].ToString();
                    break;
                case 3:
                    or1.CommandText = "DELETE FROM ICC_ABAX WHERE ABAMANDANT=:ABAMANDANT AND ABAAUFTYP=:ABAAUFTYP AND ABAAUFKRS=:ABAAUFKRS AND ABAAUFLFD=:ABAAUFLFD AND ABAAUFPOS=:ABAAUFPOS ";
                    or1.Parameters.Add("ABAMANDANT", OracleType.NVarChar).Value = dwData["ABAMANDANT"].ToString();
                    or1.Parameters.Add("ABAAUFTYP", OracleType.NVarChar).Value = dwData["ABAAUFTYP"].ToString();
                    or1.Parameters.Add("ABAAUFKRS", OracleType.NVarChar).Value = dwData["ABAAUFKRS"].ToString();
                    or1.Parameters.Add("ABAAUFLFD", OracleType.NVarChar).Value = dwData["ABAAUFLFD"].ToString();
                    or1.Parameters.Add("ABAAUFPOS", OracleType.NVarChar).Value = dwData["ABAAUFPOS"].ToString();
                    break;
                case 4:
                    or1.CommandText = "DELETE FROM ICC_ABAX WHERE  ABAVKAUFKRS=:ABAVKAUFKRS AND ABAVKAUFLFD=:ABAVKAUFLFD AND ABAVKAUFPOS=:ABAVKAUFPOS ";
                    or1.Parameters.Add("ABAVKAUFKRS", OracleType.NVarChar).Value = dwData["ABAVKAUFKRS"].ToString();
                    or1.Parameters.Add("ABAVKAUFLFD", OracleType.NVarChar).Value = dwData["ABAVKAUFLFD"].ToString();
                    or1.Parameters.Add("ABAVKAUFPOS", OracleType.NVarChar).Value = dwData["ABAVKAUFPOS"].ToString();
                    break;
                case 5:
                    or1.CommandText = "DELETE FROM ICC_ABAX WHERE  ABAVKAUFKRS=:ABAVKAUFKRS AND ABAVKAUFLFD=:ABAVKAUFLFD   ";
                    or1.Parameters.Add("ABAVKAUFKRS", OracleType.NVarChar).Value = dwData["ABAVKAUFKRS"].ToString();
                    or1.Parameters.Add("ABAVKAUFLFD", OracleType.NVarChar).Value = dwData["ABAVKAUFLFD"].ToString();
                    break;
                case 6:
                    or1.CommandText = "DELETE FROM ICC_ABAX WHERE (ABAAUFTYP='B' OR ABAAUFTYP='N' ) AND ABAVKAUFKRS=:ABAVKAUFKRS AND ABAVKAUFLFD=:ABAVKAUFLFD AND ABAVKAUFPOS=:ABAVKAUFPOS ";
                    or1.Parameters.Add("ABAVKAUFKRS", OracleType.NVarChar).Value = dwData["ABAVKAUFKRS"].ToString();
                    or1.Parameters.Add("ABAVKAUFLFD", OracleType.NVarChar).Value = dwData["ABAVKAUFLFD"].ToString();
                    or1.Parameters.Add("ABAVKAUFPOS", OracleType.NVarChar).Value = dwData["ABAVKAUFPOS"].ToString();
                    break;
                default:
                    break;
            }

            Connect2Proxy(or1);
        }
        public DataSet QueryICC_ABAX(DataRow dwData, int option = 1)
        {
            DataSet setReturn = new DataSet();
            DataSet Result = new DataSet();
            DataTable tbLocal = null;
            OracleCommand or1 = OracleDB.CreateCommand();
            // APZMANDANT  APZART APZVAR APZANRKRS APZALFDNR APZSTUFE
            string FSARTPRGR = "";
            switch (option)
            {
                case 0:
                    or1.CommandText = "SELECT * FROM ICC_ABAX WHERE ROWNUM<2";
                    break;
                case 1:
                    or1.CommandText = "SELECT * FROM ICC_ABAX WHERE ABAID=:ABAID";
                    or1.Parameters.Add("ABAID", OracleType.NVarChar).Value = dwData["ABAID"].ToString();
                    break;
                case 2:
                    or1.CommandText = "SELECT  X.* FROM ICC_ABAX X "
                    + " WHERE X.EXART LIKE '" + dwData["ABPART"].ToString() + "%'";
                    break;
                case 3:
                    or1.CommandText = "SELECT * FROM ICC_ABAX WHERE ABAMANDANT=:ABAMANDANT AND EXART LIKE '" + dwData["EXART"].ToString().Trim() + "%'";
                    or1.Parameters.Add("ABAMANDANT", OracleType.NVarChar).Value = dwData["ABAMANDANT"].ToString();
                    break;
                case 4:
                    or1.CommandText = "SELECT * FROM ICC_ABAX WHERE ABAVKAUFKRS=:ABAVKAUFKRS AND ABAVKAUFLFD=:ABAVKAUFLFD AND ABAVKAUFPOS=:ABAVKAUFPOS";
                    or1.Parameters.Add("ABAVKAUFKRS", OracleType.NVarChar).Value = dwData["ABAVKAUFKRS"].ToString();
                    or1.Parameters.Add("ABAVKAUFLFD", OracleType.NVarChar).Value = dwData["ABAVKAUFLFD"].ToString();
                    or1.Parameters.Add("ABAVKAUFPOS", OracleType.NVarChar).Value = dwData["ABAVKAUFPOS"].ToString();
                    break;
                case 5:
                    or1.CommandText = "SELECT * FROM ICC_ABAX WHERE ABAAUFKRS=:ABAAUFKRS AND ABAAUFLFD=:ABAAUFLFD AND ABAAUFPOS=:ABAAUFPOS";
                    or1.Parameters.Add("ABAAUFKRS", OracleType.NVarChar).Value = dwData["ABAAUFKRS"].ToString();
                    or1.Parameters.Add("ABAAUFLFD", OracleType.NVarChar).Value = dwData["ABAAUFLFD"].ToString();
                    or1.Parameters.Add("ABAAUFPOS", OracleType.NVarChar).Value = dwData["ABAAUFPOS"].ToString();
                    break;
                case 6:
                    or1.CommandText = "SELECT * FROM ICC_ABAX WHERE ABAMANDANT=:ABAMANDANT AND EXART LIKE '" + dwData["EXART"].ToString().Trim() + "%'";
                    or1.Parameters.Add("ABAMANDANT", OracleType.NVarChar).Value = dwData["ABAMANDANT"].ToString();
                    break;
                case 7:
                    or1.CommandText = "SELECT * FROM ICC_ABAX WHERE (ABAVKAUFKRS=:ABAVKAUFKRS AND ABAVKAUFLFD=:ABAVKAUFLFD AND ABAVKAUFPOS=:ABAVKAUFPOS) OR (ABAAUFKRS=:ABAAUFKRS AND ABAAUFLFD=:ABAAUFLFD AND ABAAUFPOS=:ABAAUFPOS)";
                    or1.Parameters.Add("ABAVKAUFKRS", OracleType.NVarChar).Value = dwData["ABAVKAUFKRS"].ToString();
                    or1.Parameters.Add("ABAVKAUFLFD", OracleType.NVarChar).Value = dwData["ABAVKAUFLFD"].ToString();
                    or1.Parameters.Add("ABAVKAUFPOS", OracleType.NVarChar).Value = dwData["ABAVKAUFPOS"].ToString();
                     or1.Parameters.Add("ABAAUFKRS", OracleType.NVarChar).Value = dwData["ABAAUFKRS"].ToString();
                    or1.Parameters.Add("ABAAUFLFD", OracleType.NVarChar).Value = dwData["ABAAUFLFD"].ToString();
                    or1.Parameters.Add("ABAAUFPOS", OracleType.NVarChar).Value = dwData["ABAAUFPOS"].ToString();
                    break;
                case 8:
                    or1.CommandText = "SELECT DISTINCT ABAAUFTYP,ABAAUFKRS,ABAAUFLFD,ABAAUFPOS,ABAVKAUFKRS,ABAVKAUFLFD,ABAVKAUFPOS FROM ICC_ABAX WHERE ABAMANDANT=:ABAMANDANT: AND EXART LIKE '" + dwData["C20"].ToString().Trim() + "%'";
                    or1.CommandText = InjectData(or1.CommandText, dwData);
                    break;
                    
            }

            Result = Connect2Proxy(or1);
            if (Result.Tables.Count > 0)
            {
                tbLocal = Result.Tables[0];
                tbLocal.TableName = "ICC_ABAX";
            }
            setReturn.Merge(Result);
            return setReturn;
        }
        public void UpdateICC_ABAX(DataRow dwData, int option, string ITXDBVERSION = "50.24")
        {
           
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    #region==
                    or1.CommandText = "UPDATE ICC_ABAX SET "
+ "ABAID=:ABAID,"
+ "ABAMANDANT=:ABAMANDANT,"
+ "ABAAUFTYP=:ABAAUFTYP,"
+ "ABAAUFKRS=:ABAAUFKRS,"
+ "ABAAUFLFD=:ABAAUFLFD,"
+ "ABAAUFPOS=:ABAAUFPOS,"
+ "ABAAPOS=:ABAAPOS,"
+ "ABAWAKZ=:ABAWAKZ,"
+ "ABAART=:ABAART,"
+ "ABAVAR=:ABAVAR,"
+ "ABAFARBE=:ABAFARBE,"
+ "ABACOLORREF=:ABACOLORREF,"
+ "ABAVKART=:ABAVKART,"
+ "ABAVKFARBE=:ABAVKFARBE,"
+ "ABABESCHICH=:ABABESCHICH,"
+ "ABAGROE=:ABAGROE,"
+ "ABAERLKZ=:ABAERLKZ,"
+ "ABARESMG=:ABARESMG,"
+ "ABASSTKWG=:ABASSTKWG,"
+ "ABARESKG=:ABARESKG,"
+ "ABABASMG=:ABABASMG,"
+ "ABAABF=:ABAABF,"
+ "ABAREUNIT=:ABAREUNIT,"
+ "ABABSFDZ=:ABABSFDZ,"
+ "PLANID=:PLANID,"
+ "QTYEND=:QTYEND,"
+ "QTYMAT=:QTYMAT,"
+ "QTYENDDES=:QTYENDDES,"
+ "LEADTIME=:LEADTIME,"
+ "DELDATE=:DELDATE,"
+ "STARTDATE=:STARTDATE,"
+ "UMS=:UMS,"
+ "UNITNUM=:UNITNUM,"
+ "UNDES=:UNDES,"
+ "UNITQTY=:UNITQTY,"
+ "UQDES=:UQDES,"
+ "TTENDS=:TTENDS,"
+ "UENDS=:UENDS,"
+ "R01=:R01,"
+ "R01DES=:R01DES,"
+ "R02=:R02,"
+ "R02DES=:R02DES,"
+ "F01=:F01,"
+ "F01DES=:F01DES,"
+ "F02=:F02,"
+ "F02DES=:F02DES,"
+ "JNUM=:JNUM,"
+ "JNUMDES=:JNUMDES,"
+ "JWASTGE=:JWASTGE,"
+ "JWASTAGEDES=:JWASTAGEDES,"
+ "BMBAUMKRS=:BMBAUMKRS,"
+ "BMBAUMLFD=:BMBAUMLFD,"
+ "ABAUMART=:ABAUMART,"
+ "ABALLEIST=:ABALLEIST,"
+ "ABARLEIST=:ABARLEIST,"
+ "ABADOMKZ=:ABADOMKZ,"
+ "ABAQTYRESERVE=:ABAQTYRESERVE,"
+ "ABAQTYALLOCATE=:ABAQTYALLOCATE,"
+ "ABAQTYRECEIVED=:ABAQTYRECEIVED,"
+ "ABAVKAUFTYP=:ABAVKAUFTYP,"
+ "ABAVKAUFKRS=:ABAVKAUFKRS,"
+ "ABAVKAUFLFD=:ABAVKAUFLFD,"
+ "ABAVKAUFPOS=:ABAVKAUFPOS,"
+ "ABAVKUPOS=:ABAVKUPOS,"
+ "ABASANZSTK=:ABASANZSTK,"
+ "ABASSTKGEW=:ABASSTKGEW,"
+ "ABASSTKLG=:ABASSTKLG,"
+ "ABAVB=:ABAVB,"
+ "ABAVG=:ABAVG,"
+ "ABARVSACHB=:ABARVSACHB,"
+ "ABARKUNDNR=:ABARKUNDNR,"
+ "ABAVLSACHB=:ABAVLSACHB,"
+ "ABAVLVB=:ABAVLVB,"
+ "ABAAUFMSL=:ABAAUFMSL,"
+ "ABAPACKTYP=:ABAPACKTYP,"
+ "ABAHUELSE=:ABAHUELSE,"
+ "ABAVLVG=:ABAVLVG,"
+ "PREALLOCATED=:PREALLOCATED,"
+ "REPEATORDER=:REPEATORDER,"
+ "FSARTPRGR=:FSARTPRGR,"
+ "ABPWAKZ=:ABPWAKZ,"
+ "ABPART=:ABPART,"
+ "ABPVAR=:ABPVAR,"
+ "ABPFARBE=:ABPFARBE,"
+ "ABPBESCHICH=:ABPBESCHICH,"
+ "ABPGROE=:ABPGROE,"
+ "FSABEZ=:FSABEZ,"
+ "FSFFBEZ=:FSFFBEZ,"
+ "LSLIEFNR=:LSLIEFNR,"
+ "LSLIEFNA=:LSLIEFNA,"
+ "ABANEUDAT=:ABANEUDAT,"
+ "SELLER=:SELLER,"
+ "SELLERNAME=:SELLERNAME,"
+ "FSSZUSCHN=:FSSZUSCHN,"
+ "MTYPE=:MTYPE,"
+ "CDES=:CDES,"
+ "ARTDES=:ARTDES,"
+ "QTYSTD=:QTYSTD,"
+ "QTYPLAN=:QTYPLAN,"
+ "QTYACT=:QTYACT,"
+ "PRSTD=:PRSTD,"
+ "PREK=:PREK,"
+ "PRPLAN=:PRPLAN,"
+ "VQTYSTDPRSTD=:VQTYSTDPRSTD,"
+ "VQTYSTDPREK=:VQTYSTDPREK,"
+ "VQTYSTDPRPLAN=:VQTYSTDPRPLAN,"
+ "VQTYPLANPRSTD=:VQTYPLANPRSTD,"
+ "VQTYPLANPREK=:VQTYPLANPREK,"
+ "VQTYPLANPRPLAN=:VQTYPLANPRPLAN,"
+ "VQTYACTPRSTD=:VQTYACTPRSTD,"
+ "VQTYACTPREK=:VQTYACTPREK,"
+ "VQTYACTPRPLAN=:VQTYACTPRPLAN,"
+ "MTRREQ=:MTRREQ,"
+ "REQ=:REQ,"
+ "REMARK=:REMARK,"
+ "RATIO=:RATIO,"
+ "UM=:UM,"
+ "CONTROL=:CONTROL,"
+ "EXART=:EXART,"
+ "EXCOLOR=:EXCOLOR,"
+ "SPINLOT=:SPINLOT,"
+ "FBRTU=:FBRTU,"
+ "FBRTL=:FBRTL,"
+ "ABAVKENDD=:ABAVKENDD,"
+ "ABAVKSTARTD=:ABAVKSTARTD,"
+ "ABASA=:ABASA,"
+ "ABALO=:ABALO,"
+ "ABALB=:ABALB,"
+ "ABALP=:ABALP,"
+ "ABADISPOKZ=:ABADISPOKZ,"
+ "ABAUSER=:ABAUSER,"
+ "ABADATE=:ABADATE "
                    #endregion
                + " WHERE  "
                     + "  ABAID=:ABAID ";
                    #region===

                    or1.Parameters.Add("ABAID", OracleType.NVarChar).Value = dwData["ABAID"].ToString();
                    or1.Parameters.Add("ABAMANDANT", OracleType.NVarChar).Value = dwData["ABAMANDANT"].ToString();
                    or1.Parameters.Add("ABAAUFTYP", OracleType.NVarChar).Value = dwData["ABAAUFTYP"].ToString();
                    or1.Parameters.Add("ABAAUFKRS", OracleType.NVarChar).Value = dwData["ABAAUFKRS"].ToString();
                    or1.Parameters.Add("ABAAUFLFD", OracleType.NVarChar).Value = dwData["ABAAUFLFD"].ToString();
                    or1.Parameters.Add("ABAAUFPOS", OracleType.NVarChar).Value = dwData["ABAAUFPOS"].ToString();
                    or1.Parameters.Add("ABAAPOS", OracleType.NVarChar).Value = dwData["ABAAPOS"].ToString();
                    or1.Parameters.Add("ABAWAKZ", OracleType.NVarChar).Value = dwData["ABAWAKZ"].ToString();
                    or1.Parameters.Add("ABAART", OracleType.NVarChar).Value = dwData["ABAART"].ToString();
                    or1.Parameters.Add("ABAVAR", OracleType.NVarChar).Value = dwData["ABAVAR"].ToString();
                    or1.Parameters.Add("ABAFARBE", OracleType.NVarChar).Value = dwData["ABAFARBE"].ToString();
                    or1.Parameters.Add("ABACOLORREF", OracleType.NVarChar).Value = dwData["ABACOLORREF"].ToString();
                    or1.Parameters.Add("ABAVKART", OracleType.NVarChar).Value = dwData["ABAVKART"].ToString();
                    or1.Parameters.Add("ABAVKFARBE", OracleType.NVarChar).Value = dwData["ABAVKFARBE"].ToString();
                    or1.Parameters.Add("ABABESCHICH", OracleType.NVarChar).Value = dwData["ABABESCHICH"].ToString();
                    or1.Parameters.Add("ABAGROE", OracleType.NVarChar).Value = dwData["ABAGROE"].ToString();
                    or1.Parameters.Add("ABAERLKZ", OracleType.NVarChar).Value = dwData["ABAERLKZ"].ToString();
                    or1.Parameters.Add("ABARESMG", OracleType.NVarChar).Value = dwData["ABARESMG"].ToString();
                    or1.Parameters.Add("ABASSTKWG", OracleType.NVarChar).Value = dwData["ABASSTKWG"].ToString();
                    or1.Parameters.Add("ABARESKG", OracleType.NVarChar).Value = dwData["ABARESKG"].ToString();
                    or1.Parameters.Add("ABABASMG", OracleType.NVarChar).Value = dwData["ABABASMG"].ToString();
                    or1.Parameters.Add("ABAABF", OracleType.NVarChar).Value = dwData["ABAABF"].ToString();
                    or1.Parameters.Add("ABAREUNIT", OracleType.NVarChar).Value = dwData["ABAREUNIT"].ToString();
                    or1.Parameters.Add("ABABSFDZ", OracleType.NVarChar).Value = dwData["ABABSFDZ"].ToString();
                    or1.Parameters.Add("PLANID", OracleType.NVarChar).Value = dwData["PLANID"].ToString();
                    or1.Parameters.Add("QTYEND", OracleType.NVarChar).Value = dwData["QTYEND"].ToString();
                    or1.Parameters.Add("QTYMAT", OracleType.NVarChar).Value = dwData["QTYMAT"].ToString();
                    or1.Parameters.Add("QTYENDDES", OracleType.NVarChar).Value = dwData["QTYENDDES"].ToString();
                    or1.Parameters.Add("LEADTIME", OracleType.NVarChar).Value = dwData["LEADTIME"].ToString();
                    or1.Parameters.Add("DELDATE", OracleType.NVarChar).Value = dwData["DELDATE"].ToString();
                    or1.Parameters.Add("STARTDATE", OracleType.NVarChar).Value = dwData["STARTDATE"].ToString();
                    or1.Parameters.Add("UMS", OracleType.NVarChar).Value = dwData["UMS"].ToString();
                    or1.Parameters.Add("UNITNUM", OracleType.NVarChar).Value = dwData["UNITNUM"].ToString();
                    or1.Parameters.Add("UNDES", OracleType.NVarChar).Value = dwData["UNDES"].ToString();
                    or1.Parameters.Add("UNITQTY", OracleType.NVarChar).Value = dwData["UNITQTY"].ToString();
                    or1.Parameters.Add("UQDES", OracleType.NVarChar).Value = dwData["UQDES"].ToString();
                    or1.Parameters.Add("TTENDS", OracleType.NVarChar).Value = dwData["TTENDS"].ToString();
                    or1.Parameters.Add("UENDS", OracleType.NVarChar).Value = dwData["UENDS"].ToString();
                    or1.Parameters.Add("R01", OracleType.NVarChar).Value = dwData["R01"].ToString();
                    or1.Parameters.Add("R01DES", OracleType.NVarChar).Value = dwData["R01DES"].ToString();
                    or1.Parameters.Add("R02", OracleType.NVarChar).Value = dwData["R02"].ToString();
                    or1.Parameters.Add("R02DES", OracleType.NVarChar).Value = dwData["R02DES"].ToString();
                    or1.Parameters.Add("F01", OracleType.NVarChar).Value = dwData["F01"].ToString();
                    or1.Parameters.Add("F01DES", OracleType.NVarChar).Value = dwData["F01DES"].ToString();
                    or1.Parameters.Add("F02", OracleType.NVarChar).Value = dwData["F02"].ToString();
                    or1.Parameters.Add("F02DES", OracleType.NVarChar).Value = dwData["F02DES"].ToString();
                    or1.Parameters.Add("JNUM", OracleType.NVarChar).Value = dwData["JNUM"].ToString();
                    or1.Parameters.Add("JNUMDES", OracleType.NVarChar).Value = dwData["JNUMDES"].ToString();
                    or1.Parameters.Add("JWASTGE", OracleType.NVarChar).Value = dwData["JWASTGE"].ToString();
                    or1.Parameters.Add("JWASTAGEDES", OracleType.NVarChar).Value = dwData["JWASTAGEDES"].ToString();
                    or1.Parameters.Add("BMBAUMKRS", OracleType.NVarChar).Value = dwData["BMBAUMKRS"].ToString();
                    or1.Parameters.Add("BMBAUMLFD", OracleType.NVarChar).Value = dwData["BMBAUMLFD"].ToString();
                    or1.Parameters.Add("ABAUMART", OracleType.NVarChar).Value = dwData["ABAUMART"].ToString();
                    or1.Parameters.Add("ABALLEIST", OracleType.NVarChar).Value = dwData["ABALLEIST"].ToString();
                    or1.Parameters.Add("ABARLEIST", OracleType.NVarChar).Value = dwData["ABARLEIST"].ToString();
                    or1.Parameters.Add("ABADOMKZ", OracleType.NVarChar).Value = dwData["ABADOMKZ"].ToString();
                    or1.Parameters.Add("ABAQTYRESERVE", OracleType.NVarChar).Value = dwData["ABAQTYRESERVE"].ToString();
                    or1.Parameters.Add("ABAQTYALLOCATE", OracleType.NVarChar).Value = dwData["ABAQTYALLOCATE"].ToString();
                    or1.Parameters.Add("ABAQTYRECEIVED", OracleType.NVarChar).Value = dwData["ABAQTYRECEIVED"].ToString();
                    or1.Parameters.Add("ABAVKAUFTYP", OracleType.NVarChar).Value = dwData["ABAVKAUFTYP"].ToString();
                    or1.Parameters.Add("ABAVKAUFKRS", OracleType.NVarChar).Value = dwData["ABAVKAUFKRS"].ToString();
                    or1.Parameters.Add("ABAVKAUFLFD", OracleType.NVarChar).Value = dwData["ABAVKAUFLFD"].ToString();
                    or1.Parameters.Add("ABAVKAUFPOS", OracleType.NVarChar).Value = dwData["ABAVKAUFPOS"].ToString();
                    or1.Parameters.Add("ABAVKUPOS", OracleType.NVarChar).Value = dwData["ABAVKUPOS"].ToString();
                    or1.Parameters.Add("ABASANZSTK", OracleType.NVarChar).Value = dwData["ABASANZSTK"].ToString();
                    or1.Parameters.Add("ABASSTKGEW", OracleType.NVarChar).Value = dwData["ABASSTKGEW"].ToString();
                    or1.Parameters.Add("ABASSTKLG", OracleType.NVarChar).Value = dwData["ABASSTKLG"].ToString();
                    or1.Parameters.Add("ABAVB", OracleType.NVarChar).Value = dwData["ABAVB"].ToString();
                    or1.Parameters.Add("ABAVG", OracleType.NVarChar).Value = dwData["ABAVG"].ToString();
                    or1.Parameters.Add("ABARVSACHB", OracleType.NVarChar).Value = dwData["ABARVSACHB"].ToString();
                    or1.Parameters.Add("ABARKUNDNR", OracleType.NVarChar).Value = dwData["ABARKUNDNR"].ToString();
                    or1.Parameters.Add("ABAVLSACHB", OracleType.NVarChar).Value = dwData["ABAVLSACHB"].ToString();
                    or1.Parameters.Add("ABAVLVB", OracleType.NVarChar).Value = dwData["ABAVLVB"].ToString();
                    or1.Parameters.Add("ABAAUFMSL", OracleType.NVarChar).Value = dwData["ABAAUFMSL"].ToString();
                    or1.Parameters.Add("ABAPACKTYP", OracleType.NVarChar).Value = dwData["ABAPACKTYP"].ToString();
                    or1.Parameters.Add("ABAHUELSE", OracleType.NVarChar).Value = dwData["ABAHUELSE"].ToString();
                    or1.Parameters.Add("ABAVLVG", OracleType.NVarChar).Value = dwData["ABAVLVG"].ToString();
                    or1.Parameters.Add("PREALLOCATED", OracleType.NVarChar).Value = dwData["PREALLOCATED"].ToString();
                    or1.Parameters.Add("REPEATORDER", OracleType.NVarChar).Value = dwData["REPEATORDER"].ToString();
                    or1.Parameters.Add("FSARTPRGR", OracleType.NVarChar).Value = dwData["FSARTPRGR"].ToString();
                    or1.Parameters.Add("ABPWAKZ", OracleType.NVarChar).Value = dwData["ABPWAKZ"].ToString();
                    or1.Parameters.Add("ABPART", OracleType.NVarChar).Value = dwData["ABPART"].ToString();
                    or1.Parameters.Add("ABPVAR", OracleType.NVarChar).Value = dwData["ABPVAR"].ToString();
                    or1.Parameters.Add("ABPFARBE", OracleType.NVarChar).Value = dwData["ABPFARBE"].ToString();
                    or1.Parameters.Add("ABPBESCHICH", OracleType.NVarChar).Value = dwData["ABPBESCHICH"].ToString();
                    or1.Parameters.Add("ABPGROE", OracleType.NVarChar).Value = dwData["ABPGROE"].ToString();
                    or1.Parameters.Add("FSABEZ", OracleType.NVarChar).Value = dwData["FSABEZ"].ToString();
                    or1.Parameters.Add("FSFFBEZ", OracleType.NVarChar).Value = dwData["FSFFBEZ"].ToString();
                    or1.Parameters.Add("LSLIEFNR", OracleType.NVarChar).Value = dwData["LSLIEFNR"].ToString();
                    or1.Parameters.Add("LSLIEFNA", OracleType.NVarChar).Value = dwData["LSLIEFNA"].ToString();
                    or1.Parameters.Add("ABANEUDAT", OracleType.NVarChar).Value = dwData["ABANEUDAT"].ToString();
                    or1.Parameters.Add("SELLER", OracleType.NVarChar).Value = dwData["SELLER"].ToString();
                    or1.Parameters.Add("SELLERNAME", OracleType.NVarChar).Value = dwData["SELLERNAME"].ToString();
                    or1.Parameters.Add("FSSZUSCHN", OracleType.NVarChar).Value = dwData["FSSZUSCHN"].ToString();
                    or1.Parameters.Add("MTYPE", OracleType.NVarChar).Value = dwData["MTYPE"].ToString();
                    or1.Parameters.Add("CDES", OracleType.NVarChar).Value = dwData["CDES"].ToString();
                    or1.Parameters.Add("ARTDES", OracleType.NVarChar).Value = dwData["ARTDES"].ToString();
                    or1.Parameters.Add("QTYSTD", OracleType.NVarChar).Value = dwData["QTYSTD"].ToString();
                    or1.Parameters.Add("QTYPLAN", OracleType.NVarChar).Value = dwData["QTYPLAN"].ToString();
                    or1.Parameters.Add("QTYACT", OracleType.NVarChar).Value = dwData["QTYACT"].ToString();
                    or1.Parameters.Add("PRSTD", OracleType.NVarChar).Value = dwData["PRSTD"].ToString();
                    or1.Parameters.Add("PREK", OracleType.NVarChar).Value = dwData["PREK"].ToString();
                    or1.Parameters.Add("PRPLAN", OracleType.NVarChar).Value = dwData["PRPLAN"].ToString();
                    or1.Parameters.Add("VQTYSTDPRSTD", OracleType.NVarChar).Value = dwData["VQTYSTDPRSTD"].ToString();
                    or1.Parameters.Add("VQTYSTDPREK", OracleType.NVarChar).Value = dwData["VQTYSTDPREK"].ToString();
                    or1.Parameters.Add("VQTYSTDPRPLAN", OracleType.NVarChar).Value = dwData["VQTYSTDPRPLAN"].ToString();
                    or1.Parameters.Add("VQTYPLANPRSTD", OracleType.NVarChar).Value = dwData["VQTYPLANPRSTD"].ToString();
                    or1.Parameters.Add("VQTYPLANPREK", OracleType.NVarChar).Value = dwData["VQTYPLANPREK"].ToString();
                    or1.Parameters.Add("VQTYPLANPRPLAN", OracleType.NVarChar).Value = dwData["VQTYPLANPRPLAN"].ToString();
                    or1.Parameters.Add("VQTYACTPRSTD", OracleType.NVarChar).Value = dwData["VQTYACTPRSTD"].ToString();
                    or1.Parameters.Add("VQTYACTPREK", OracleType.NVarChar).Value = dwData["VQTYACTPREK"].ToString();
                    or1.Parameters.Add("VQTYACTPRPLAN", OracleType.NVarChar).Value = dwData["VQTYACTPRPLAN"].ToString();
                    or1.Parameters.Add("MTRREQ", OracleType.NVarChar).Value = dwData["MTRREQ"].ToString();
                    or1.Parameters.Add("REQ", OracleType.NVarChar).Value = dwData["REQ"].ToString();
                    or1.Parameters.Add("REMARK", OracleType.NVarChar).Value = dwData["REMARK"].ToString();
                    or1.Parameters.Add("RATIO", OracleType.NVarChar).Value = dwData["RATIO"].ToString();
                    or1.Parameters.Add("UM", OracleType.NVarChar).Value = dwData["UM"].ToString();
                    or1.Parameters.Add("CONTROL", OracleType.NVarChar).Value = dwData["CONTROL"].ToString();
                    or1.Parameters.Add("EXART", OracleType.NVarChar).Value = dwData["EXART"].ToString();
                    or1.Parameters.Add("EXCOLOR", OracleType.NVarChar).Value = dwData["EXCOLOR"].ToString();
                    or1.Parameters.Add("SPINLOT", OracleType.NVarChar).Value = dwData["SPINLOT"].ToString();
                    or1.Parameters.Add("FBRTU", OracleType.NVarChar).Value = dwData["FBRTU"].ToString();
                    or1.Parameters.Add("FBRTL", OracleType.NVarChar).Value = dwData["FBRTL"].ToString();
                    or1.Parameters.Add("ABAVKENDD", OracleType.NVarChar).Value = dwData["ABAVKENDD"].ToString();
                    or1.Parameters.Add("ABAVKSTARTD", OracleType.NVarChar).Value = dwData["ABAVKSTARTD"].ToString();
                    or1.Parameters.Add("ABASA", OracleType.NVarChar).Value = dwData["ABASA"].ToString();
                    or1.Parameters.Add("ABALO", OracleType.NVarChar).Value = dwData["ABALO"].ToString();
                    or1.Parameters.Add("ABALB", OracleType.NVarChar).Value = dwData["ABALB"].ToString();
                    or1.Parameters.Add("ABALP", OracleType.NVarChar).Value = dwData["ABALP"].ToString();
                    or1.Parameters.Add("ABADISPOKZ", OracleType.NVarChar).Value = dwData["ABADISPOKZ"].ToString();
                    or1.Parameters.Add("ABAUSER", OracleType.NVarChar).Value = dwData["ABAUSER"].ToString();
                    or1.Parameters.Add("ABADATE", OracleType.NVarChar).Value = dwData["ABADATE"].ToString();
                    #endregion
                    break;
                case 2:
                    or1.CommandText = "UPDATE ICC_ABAX SET ABAART=:ABAART,ABAVAR=:ABAVAR,ABAFARBE=:ABAFARBE"
                        + " WHERE ABAAUFKRS=:ABAAUFKRS AND ABAAUFLFD=:ABAAUFLFD AND ABAAUFPOS=:ABAAUFPOS";
                    or1.Parameters.Add("ABAAUFKRS", OracleType.NVarChar).Value = dwData["ABAAUFKRS"].ToString();
                    or1.Parameters.Add("ABAAUFLFD", OracleType.NVarChar).Value = dwData["ABAAUFLFD"].ToString();
                    or1.Parameters.Add("ABAAUFPOS", OracleType.NVarChar).Value = dwData["ABAAUFPOS"].ToString();
                    or1.Parameters.Add("ABAART", OracleType.NVarChar).Value = dwData["ABAART"].ToString();
                    or1.Parameters.Add("ABAVAR", OracleType.NVarChar).Value = dwData["ABAVAR"].ToString();
                    or1.Parameters.Add("ABAFARBE", OracleType.NVarChar).Value = dwData["ABAFARBE"].ToString();
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }
        public void InsertICC_ABAX(DataRow dwData, int option, string ITXDBVERSION = "50.24")
        {
            OracleCommand or1;
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "INSERT INTO ICC_ABAX(ABAID)  VALUES (:ABAID)";
                    or1.Parameters.Add("ABAID", OracleType.NVarChar).Value = dwData["ABAID"].ToString();
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }
    }
}
